package com.fpt.edu.vn.h2tv.dao.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * TbOrderDetail entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "tb_order_detail", catalog = "bookdb")
public class TbOrderDetail implements java.io.Serializable {

	// Fields

	private Long orderdetailid;
	private TbBook tbBook;
	private TbOrder tbOrder;
	private Integer quantity;

	// Constructors

	/** default constructor */
	public TbOrderDetail() {
	}

	/** full constructor */
	public TbOrderDetail(TbBook tbBook, TbOrder tbOrder, Integer quantity) {
		this.tbBook = tbBook;
		this.tbOrder = tbOrder;
		this.quantity = quantity;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "ORDERDETAILID", unique = true, nullable = false)
	public Long getOrderdetailid() {
		return this.orderdetailid;
	}

	public void setOrderdetailid(Long orderdetailid) {
		this.orderdetailid = orderdetailid;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "BOOKID", nullable = false)
	public TbBook getTbBook() {
		return this.tbBook;
	}

	public void setTbBook(TbBook tbBook) {
		this.tbBook = tbBook;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ORDERID", nullable = false)
	public TbOrder getTbOrder() {
		return this.tbOrder;
	}

	public void setTbOrder(TbOrder tbOrder) {
		this.tbOrder = tbOrder;
	}

	@Column(name = "QUANTITY", nullable = false)
	public Integer getQuantity() {
		return this.quantity;
	}

	public void setQuantity(Integer quantity) {
		this.quantity = quantity;
	}

}